const util = require('../../../utils/util.js')
const ajax = require('../../../utils/ajax/ajax.js')
Page({
    data: {
        title: '',
        time: '',
        content: ''
    },
    onLoad: function (options) {
        const newsId = options.newsId
        this.getArticleDetails(newsId)
    },
    getArticleDetails(newsId) {
        const that = this
        ajax.post({
            url: '/wx/getInformationDetail',
            data: {
                id: newsId
            },
            success(res) {
                const { content, create_time, title } = res.data
                that.setData({
                    title: title,
                    time: util.formatTime(create_time, 'Y-M-D h:m'),
                    content: content.replace(/<img/g,
						"<img style='display:inline-block;max-width:100%;height:auto;'")
                })
            }
        })
    }
})